-
Notifications
You must be signed in to change notification settings - Fork 982
Download testing emulators using a buffer #8569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Vertex AI Mock Responses Check
|
Size Report 1Affected ProductsNo changes between base commit (56507af) and merge commit (0ba7398).Test Logs |
Size Analysis Report 1Affected ProductsNo changes between base commit (56507af) and merge commit (0ba7398).Test Logs |
* downloaded emulator. Unfortunately, we can't access `this` when inside `readChunk`'s scope, since | ||
* it's a named function expression, and does not inherit the `this` object from it's parent. | ||
* To work around this, we wrap the fetch in a promise, | ||
* then once it's resolved we can access `this` in a callback arrow function that *does* inherit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a couple of other ways around this, I think, not 100% sure. One is to set like const self = this
at the top level (outside of the fetch anyway) and then you call self.binaryPath
when needed. That looks weird so another better looking option is that you create a function at the top level called setBinaryPath
that is just like
const setBinaryPath = (binaryPath) => this.binaryPath = binaryPath;
And then I think you can call setBinaryPath inside readChunk. I'm not 100% sure but I think they should work? If they don't, never mind.
The streaming file download was failing when downloading the data connect emulator in CI only (reasons unknown). To fix the issue, we can download the file to a buffer (
Uint8Array
), then write it synchronously to disk.We preferred the streaming approach because it meant we didn't have to store the entire emulator file in memory, but I found that this buffer approach uses roughly the same amount of memory (~195mB in total for the test process).